<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>导入门店</title>
	{$h->import('static/css/layui.css')}
	{$h->import('static/css/HyqPublic.css')}
	{$h->import('static/css/common.css')}
	<style type="text/css">
		body{
			margin: 0;
			color: rgba(0,0,0,.65);
			font-size: 14px;
		}
	</style>
</head>
<body>
	<div class="public_Pop_container">
		<h3 class="public_PopTitle">区域扫码进城市群</h3>
		<br>
		<form class="layui-form" action="">
		  	<div class="layui-form-item">
		    <label class="layui-form-label" style="width: 120px;text-align: left;">添加城市群方式：</label>
		    	<div class="layui-input-block">
		      		<input type="radio" name="add_s" value="1" lay-filter="add_s" title="批量导入" checked>
		      		<input type="radio" name="add_s" value="2" lay-filter="add_s" title="手动录入">
		    	</div>
		  	</div>
		</form>
		<div id="top1">
			<div class="public_PopTips_container">
				<svg t="1622540008125" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4204" width="14" height="14"><path d="M595.138 889.173c16.52 0 29.914 13.393 29.914 29.913 0 16.521-13.393 29.914-29.914 29.914H436.563c-16.52 0-29.914-13.393-29.914-29.914 0-16.52 13.393-29.913 29.914-29.913h158.575z m-494.224-66.73C84.393 822.442 71 809.05 71 792.528s13.393-29.914 29.914-29.914h98.828V474.698c0-165.138 126.17-300.806 287.37-315.869l0.001-58.942C487.113 83.38 500.494 70 517 70s29.887 13.38 29.887 29.887l0.001 58.942c161.2 15.063 287.37 150.731 287.37 315.869l-0.001 287.917h98.83c16.52 0 29.913 13.393 29.913 29.914 0 16.52-13.393 29.913-29.914 29.913H100.914z" fill="#1990ff" p-id="4205"></path></svg>
				<p>可下载模版，填写门店相关信息后导入，可以快捷录入门店信息。配置过程较为复杂，可<a href="#">联系客服</a>提供人工配置服务</p>
			</div>
			<div class="public_UploadDrag_container">
				<div class="layui-upload-drag" id="test10">
				  	<i class="layui-icon" id="clai"></i>
				 	<p id="text">点击上传，或将文件拖拽到此处</p>
				 	<input type="hidden" name="file_path" id="url">
				</div>
			</div>
			<div class="public_explain_container" style="margin-top: 8px;">
				<p>导入须知：</p>
				<p>1、下载 <a href="{$h->import('static/css/qy/stores/cheng.xlsx')}">导入模板</a>，根据模版填写门店、地址、店主姓名、店主电话</p>
				<p>2、门店地址请按照「xxx省xxx市xxx区xxx号」格式填写详细地址，以便系统录入</p>
				<p>3、请确保填写的店主电话与员工在企业微信的手机号一致，否则将无法匹配对应的员工</p>
				<p>4、导入的门店信息重复，系统将自动过滤</p>
			</div>
		</div>
		<div id="top2" style="display: none;">
		  	<div class="layui-form-item">
		    <label class="layui-form-label" >选择城市：</label>
		    	<div class="layui-input-block">
		      		<button type="button" class="layui-btn layui-btn-primary public-button-border-blue public_button" id="Add-city">+添加城市</button>
		      		<input type="hidden" id="checkcity">
		      		<div id="checkcitys"></div>
		    	</div>
		  	</div>
		</div>
		<div class="public_PopMain_container layui-form">
			<div class="public_formSubmit_conainer">
             <button class="layui-btn" lay-submit lay-filter="formDemo">创建</button>
			</div>
		</div>
	</div>	
	<script src="/cdn/jquery.min.js"></script>
	<script src="/layui/layui.all.js"></script>
	<script src="/js/ajax.js"></script>
	<script type="text/javascript">
	  layui.use('form', function(){
          var form = layui.form;
          form.on('radio(add_s)', function (data) {
                if ($('input[name="add_s"]:checked').val() == "1") {
                    $("#top1").show();
                    $("#top2").hide();
                }else if($('input[name="add_s"]:checked').val() == "2"){
                	$("#top1").hide();
                	$("#top2").show();
                }
                form.render();
            });
        });
	</script>
	<script>
	//表单
	layui.use('form', function(){
		var form = layui.form;

	 //监听提交
  	form.on('submit(formDemo)', function(data){
	  	var type = $('input[name="add_s"]:checked').val();
	  		if($('input[name="add_s"]:checked').val() == 1){
	  			var file_path = $("#url").val();
	  			myAjaxPost(false, true, '', { file_path:file_path,type:type}, function (resp) {
	   				 if(resp.status == "success"){
	   				 	 layer.open({
					        type: 1
					        ,title: false //不显示标题栏
					        ,closeBtn: false
					        ,area: '300px;'
					        ,shade: 0.8
					        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
					        ,btn: ['确定']
					        ,btnAlign: 'c'
					        ,moveType: 1 //拖拽模式，0或者1
					        ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">'+resp.msg+'</div>'
					        ,yes:function(){
					    		parent.location.reload();
				        	}
					    });
	   				}else{
	   					layer.msg(resp.msg);
	   				}
	   			})
	  		}else{
	  			var checkcity = $("#checkcity").val();
	  			if(!checkcity){
	  				layer.msg("请选择城市");
	  				return false;
	  			}
	  			myAjaxPost(false, true, '', { type:type,checkcity:checkcity}, function (resp) {
	   				 if(resp.status == "success"){
	   				 	 layer.open({
					        type: 1
					        ,title: false //不显示标题栏
					        ,closeBtn: false
					        ,area: '300px;'
					        ,shade: 0.8
					        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
					        ,btn: ['确定']
					        ,btnAlign: 'c'
					        ,moveType: 1 //拖拽模式，0或者1
					        ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">'+resp.msg+'</div>'
					        ,yes:function(){
					    		parent.location.reload();
				        	}
					    });
	   				}else{
	   					layer.msg(resp.msg);
	   				}
	   			})
	  		}
	  	});
	});
	
	</script>
	<script>
	layui.use(['upload', 'element', 'layer'], function(){
	  var $ = layui.jquery
	  ,upload = layui.upload
	  ,element = layui.element
	  ,layer = layui.layer;
	  //拖拽上传
	  upload.render({
	    elem: '#test10'
	    ,url: '/Addons/StoresCode/Admin/StoresCode/upload_file.html' //改成您自己的上传接口
	    ,accept: 'file' //普通文件
	    ,done: function(res){
	    	layer.msg(res.msg);
	    	if(res.status == "success"){
	    		$("#text").html(res.data.fileName+"上传成功");
	    		$("#url").val(res.data.filePath);
	    		$("#clai").html("");
	    		$("#clai").addClass("layui-icon-ok-circle");
	    	}
	    }
	  });
	  
	});
	</script>
	<script type="text/javascript">
		$("#Add-city").on("click",function(){
			layer.open({
			  type: 2,
			  title: '选择城市城市',
			  shadeClose: true,
			  shade: 0.2,
			  area: ['800px', '568px'],
			  content: 'add_citys.html'
			}); 
		})
	</script>
</body>
</html>